package com.example.exam.controller.tools;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zhang
 */
@RestController
@RequestMapping("/swagger")
@ApiIgnore
public class SwaggerController {
    @Value("${server.servlet.context-path}")
    private String contextPath;
    @GetMapping()
    public void index(HttpServletResponse response) throws IOException {
        response.sendRedirect(contextPath + "/swagger-ui.html");
    }
}
